package com.yunkeji.dao.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunkeji.common.core.mapper.BaseMapperPlus;
import com.yunkeji.dao.domain.PayWithDraw;
import com.yunkeji.dao.vo.PayWithdrawVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

/**
 * 提现
 *
 * @author 老张
 * @date 2024-05-27
 */
public interface PayWithDrawMapper
        extends BaseMapperPlus<PayWithDrawMapper, PayWithDraw, PayWithdrawVo> {

    @Select("<script>" +
        "SELECT  " +
        "c.*,  " +
        "u.sex as sex " +
        "FROM  " +
        "ykj_pay_withdraw c  " +
        "LEFT JOIN ykj_app_user u ON c.user_id = u.id " +
        "where 1=1 " +
        "<if test='platformId!=null'>" +
        "and c.platform_id = #{platformId} " +
        "</if>" +
        "<if test='checkStatus!=null'>" +
        "and c.check_status = #{checkStatus} " +
        "</if>" +
        "<if test='payType!=null'>" +
        "and c.pay_type = #{payType} " +
        "</if>" +
        "<if test='payStatus!=null'>" +
        "and c.pay_status = #{payStatus} " +
        "</if>" +
        "<if test='withdrawDateBefore!=null'>" +
        "and c.create_time <![CDATA[>=]]> #{withdrawDateBefore} " +
        "</if>" +
        "<if test='withdrawDateAfter!=null'>" +
        "and c.create_time <![CDATA[<=]]> #{withdrawDateAfter} " +
        "</if>" +
        "<if test='checkDateBefore!=null'>" +
        "and c.check_time <![CDATA[>=]]> #{checkDateBefore} " +
        "</if>" +
        "<if test='checkDateAfter!=null'>" +
        "and c.check_time <![CDATA[<=]]> #{checkDateAfter} " +
        "</if>" +
        "order by c.create_time desc " +
        "</script>")
    Page<PayWithdrawVo> selectListPage(@Param("platformId") Long platformId,
                                     @Param("checkStatus") Integer checkStatus,
                                     @Param("payType") Integer payType,
                                     @Param("payStatus") Integer payStatus,
                                     @Param("withdrawDateBefore") Date withdrawDateBefore,
                                     @Param("withdrawDateAfter") Date withdrawDateAfter,
                                     @Param("checkDateBefore") Date checkDateBefore,
                                     @Param("checkDateAfter") Date checkDateAfter,
                                     @Param("Page") Page<PayWithDraw> Page);

}
